package com.example.dingtalklogin.adpter.web.controller;

import com.example.dingtalklogin.common.config.DingtalkProperties;
import com.example.dingtalklogin.common.util.UserUtil;
import com.example.dingtalklogin.service.dto.data.UserDto;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
public class HomeController {

    @Resource
    private DingtalkProperties dingtalkProperties;

    @GetMapping("/")
    public ModelAndView home(){

        UserDto currUser = UserUtil.getCurrUser();

        ModelAndView mav = new ModelAndView("home");

        mav.addObject("currUser", currUser);
        mav.addObject("dingtalk", dingtalkProperties);

        return mav;
    }
}
